package com.example.remsad;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;

public class SignUpActivity extends FragmentActivity {
	
	private Helper helper;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sign_up);
		populateJobList();
		helper = new Helper();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login, menu);
		return true;
	}
	
	

	public void showDatePickerDialog(View view) {
		TextView birthDayLabel = (TextView) findViewById(R.id.suBirthday);
		DatePickerFragment newFragment = new DatePickerFragment();
		newFragment.setInputId(birthDayLabel);
		newFragment.show(getSupportFragmentManager(), "datePicker");
	}

	public void populateJobList() {
		Spinner spinner = (Spinner) findViewById(R.id.suJob);
		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
				this, R.array.job_list, android.R.layout.simple_spinner_item);
		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(adapter);
	}
	
	public void SignUp(View view){
		String suEmail 		= helper.GetTextViewToString(findViewById(R.id.suEmail));
		String suPassword 	= helper.GetTextViewToString(findViewById(R.id.suPassword));
		String suName 		= helper.GetTextViewToString(findViewById(R.id.suName));
		String suBirthday 	= helper.GetTextViewToString(findViewById(R.id.suBirthday));
		String suJob 		= helper.GetSpinnerView(findViewById(R.id.suJob));	
		
		String message = suEmail + suPassword + suName + suBirthday+suJob;
		Intent intent = new Intent(this, MainActivity.class);
		intent.putExtra("message", message);
		startActivity(intent);		
		
	}
	
	
}
